<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php
echo JhtraqHelper::drawTabs($this->project->slug);
JHTML::_('behavior.formvalidation');
?>
<p></p>
<div class="componentheading">
	<?php echo $this->project->name; ?>
</div>
<?php
if($this->error)
{
	?>
	<div class="error">
		<?php echo $this->error;?>
	</div>
<?php
}
?>
<form action="<?php echo JRoute::_('index.php?option=com_jhtraq&view=newticket&project='.$this->project->slug);?>" method="post" id="josForm" name="josForm" class="form-validate">
<input type="hidden" name="task" value="save" />
<input type="hidden" name="id" value="<?php echo @$this->ticket->id;?>" />


			<fieldset>
			<legend><?php echo JText::_('COM_JHTRAQ_TICKET_DETAILS');?></legend>
			<table width="100%">
			<tr>
			<td width="35%">
			<label for="summary"><?php echo JText::_('COM_JHTRAQ_SUMMARY')?></label>
			</td>
			<td>
				<input type="text" name="summary" id="summary" class="inputbox required" value="<?php echo isset($_POST['summary'])?$_POST['summary']:@$this->ticket->summary; ?>" />
			</td>
			</tr>
			<tr>
			<td width="35%" valign="top">

			

<label for="body"><?php echo JText::_('COM_JHTRAQ_DESCRIPTION')?></label>
			</td>
			<td>
				<textarea name="body" id="body" class="inputbox required" rows="5" cols="50"><?php echo isset($_POST['body'])?$_POST['body']:@$this->ticket->body;?></textarea>
			</td>
			</tr>
			<?php
			$user = JFactory::getUser();
			if(!$user->id) { ?>
			<tr>
				<td width="35%">
				<label for="name"><?php echo JText::_('COM_JHTRAQ_YOUR_NAME')?></label>
				</td>
				<td>
				<input type="text" name="name" id="name" value="<?php echo @$_POST['name']?>" class=" inputbox required"/>
				</td>
			</tr>
			<tr>
				<td width="35%" valign="top">
					<label for="captcha"><?php echo JText::_('COM_JHTRAQ_CAPTCHA')?></label>
				</td>
				<td>					
					<?php echo $this->captchaHTML;  ?>
					<br /><?php echo @$this->captcha_error;?>
					</td></tr>
			<? } ?>
			</table>
			</fieldset>
			<fieldset id="ticket_properties" class="properties">
				<legend><?php echo JText::_('COM_JHTRAQ_PROPERTIES')?></legend>
				<table width="100%" cellpading="0" cellspacing="0">
					<tr>
						<th class="col1"><?php echo JText::_('COM_JHTRAQ_TYPE')?></th>
						<td>
							<select name="type">
								<?php echo $this->buildOptions('type');?>
							</select>
						</td>
						<th class="col2"><?php echo JText::_('COM_JHTRAQ_ASSIGN_TO')?></th>
						<td>
							<select name="assigned_to">
								<option value="0" selected=""></option>
								<?php echo $this->buildOptions('assigned_to');?>
							</select>
						</td>
					</tr>
					<tr>
						<th class="col1"><?php echo JText::_('COM_JHTRAQ_PRIORITY')?></th>
						<td>
							<select name="priority">
							<?php echo $this->buildOptions('priority');?>
							</select>
						</td>
						<th class="col2"><?php echo JText::_('COM_JHTRAQ_SEVERITY')?></th>
						<td>
							<select name="severity">
							<?php echo $this->buildOptions('severity');?>
							</select>
						</td>
					</tr>
					<tr>
						<th class="col1"><?php echo JText::_('COM_JHTRAQ_MILESTONE')?></th>
						<td>
							<select name="milestone">
							<?php echo $this->buildOptions('milestone');?>
							</select>
						</td>
						<th class="col2"><?echo JText::_('COM_JHTRAQ_VERSION')?></th>
						<td>
							<select name="version">
							<?php echo $this->buildOptions('version');?>
							</select>
						</td>
					</tr>
					<tr>
						<th class="col1"><?php echo JText::_('COM_JHTRAQ_COMPONENT')?></th>
						<td>
							<select name="component">
							<?php echo $this->buildOptions('component');?>
							</select>
						</td>
						<th class="col2"><?php echo JText::_('COM_JHTRAQ_PRIVATE_TICKET')?></th>
						<td><input type="checkbox" name="private" value="1" /></td>
					</tr>
				</table>
			</fieldset>
			
			

			
			
			<p id="buttons">
			<button class="button validate" type="submit"><?php echo JText::_('COM_JHTRAQ_SAVE'); ?></button>
			</p>
		</form>